//
//  DetailView.m
//  Read
//
//  Created by lanou on 15/12/18.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "DetailView.h"
#import "UIImageView+AFNetworking.h"
#import "Novel.h"

@implementation DetailView


- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0,CGRectGetWidth(self.frame) -10, self.bounds.size.height-49)];
        self.backScrollView.contentSize = CGSizeMake(320, 1000);
        [self addSubview:_backScrollView];
        
        
        _img_urlImageView = [[UIImageView alloc] initWithFrame:(CGRectMake(30, 50, 120, 150))];
        [_backScrollView addSubview:_img_urlImageView];
        
        _authorLabel = [[UILabel alloc] initWithFrame:(CGRectMake(170, 40, 100, 60))];
        [_backScrollView addSubview:_authorLabel];
        
        _nameLabel = [[UILabel alloc] initWithFrame:(CGRectMake(170, 70, 100, 60))];
        [_backScrollView addSubview:_nameLabel];
        
        _labelsLabel = [[UILabel alloc] initWithFrame:(CGRectMake(170, 100, 100, 60))];
        [_backScrollView addSubview:_labelsLabel];
        
        _last_chapter_nameLabel = [[UILabel alloc] initWithFrame:(CGRectMake(170, 130, 380, 100))];
        [_backScrollView addSubview:_last_chapter_nameLabel];
        
        
        //url
        _last_chapter_cuLabel = [[UILabel alloc] initWithFrame:(CGRectMake(70, 180, 270, 100))];
        _last_chapter_nameLabel.numberOfLines = 5;
        [_backScrollView addSubview:_last_chapter_cuLabel];
        
        
        self.descLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 290, CGRectGetWidth(self.frame)-30,150)];
        //self.descLabel.backgroundColor = [UIColor cyanColor];
        self.descLabel.font = [UIFont systemFontOfSize:14];
        self.descLabel.layer.borderWidth = 1;
        self.descLabel.layer.borderColor = [UIColor redColor].CGColor;
        self.descLabel.numberOfLines = 0;
        [self.backScrollView addSubview:_descLabel];
        
        
        
        
        _introduceLabel = [[UILabel alloc] initWithFrame:(CGRectMake(20, 225, 100, 100))];
        _introduceLabel.text = @"内容提要";
        [_backScrollView addSubview:_introduceLabel];
        
    }
    
    return self;
}


- (void)putValueWithModel:(Novel *)novel {
    
    [_img_urlImageView setImageWithURL:[NSURL URLWithString:novel.img_url]];
    
    _authorLabel.text = novel.author;
    _nameLabel.text = novel.name;
    _labelsLabel.text = novel.labels;
    _last_chapter_cuLabel.text = novel.last_chapter_cu;// html
    _last_chapter_nameLabel.text = novel.last_chapter_name;
    
    _descLabel.text = novel.desc;
    
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
